﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;

namespace FrostGraphics.Umbraco.ContactForm {
  public class ContactFormFieldElement : ConfigurationElement {

    [ConfigurationProperty("name", IsRequired = true, IsKey = true)]
    public string Name {
      get { return (string)this["name"]; }
      set { this["name"] = value; }
    }

    [ConfigurationProperty("label", IsRequired = true)]
    public string Label {
      get { return (string)this["label"]; }
      set { this["label"] = value; }
    }

    [ConfigurationProperty("type", IsRequired = true)]
    public string Type {
      get { return (string)this["type"]; }
      set { this["type"] = value; }
    }

    [ConfigurationProperty("defaultValue", IsRequired = false)]
    public string DefaultValue {
      get { return (string)this["defaultValue"]; }
      set {
        if (String.IsNullOrWhiteSpace(value)) {
          this["defaultValue"] = String.Empty;
        }
        else {
          this["defaultValue"] = value;
        }
      }
    }

    [ConfigurationProperty("", IsDefaultCollection = true, IsRequired=false)]
    public DropdownCollection DropdownOptions {
      get { return (DropdownCollection)this[""]; }
    }

  }
}